﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web.Mvc;
using yegtest.Models;

namespace yegtest.Controllers
{
    public class BaseController : Controller
    {
        
     
           public ticaretDataContext Db = new ticaretDataContext();
           protected override void OnActionExecuting(ActionExecutingContext filterContext)
           {
               base.OnActionExecuting(filterContext);
               //var Yeg = new Dictionary<string, Dictionary<string, string>>();
               //foreach (var item in Db.Categories.OrderBy(d => d.OrderNumber).ToList())
               //{
               //    var ups = new Dictionary<string, string>();
               //    ups.Add("Text", item.Text);
               //    ups.Add("Seo", item.SeoText);
               //    ups.Add("Id", item.Id.ToString());
               //    Yeg.Add(item.SeoText, ups);
               //}
               //ViewBag.Yeg = Yeg;



               ViewBag.CategoryList = Db.Categories.OrderBy(d => d.OrderNumber).ToList().ToDictionary(item => item.SeoText, item => new Cat { Id = item.Id, SeoText = item.SeoText, Text = item.Text });
           }
    }
}
